import orm from '@main/db/orm'
import { IpcHandler, IpcInvoke } from '@main/decorator/ipc.decorator'
import { Injectable } from '@nestjs/common'
import type { User } from '@shared/types/entity'

@IpcHandler('user')
@Injectable()
export class UserApi {
  @IpcInvoke('getList')
  async getList(): Promise<User[]> {
    return await orm.query.users.findMany()
  }
}
